feat(contracts): enforce EIP-7825 gas cap in NUT bundle validation#20205
Merged
maurelian merged 6 commits intoethereum-optimism:developfrom Apr 23, 2026
Merged
Conversation
Contributor
|
/ci authorize 0885ccf |
0xiamflux
reviewed
Apr 21, 2026
0xniha
reviewed
Apr 21, 2026
… bundle gasLimit check
maurelian
approved these changes
Apr 22, 2026
Contributor
|
/ci authorize 51ae847 |
0xiamflux
approved these changes
Apr 22, 2026
…avoid heavy-fuzz race
…ut-bundle-gas-cap
Contributor
|
/ci authorize 1d470ff |
0xOneTony
approved these changes
Apr 23, 2026
Merged
via the queue into
ethereum-optimism:develop
with commit Apr 23, 2026
1f70eba
129 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a per-transaction EIP-7825 gas cap check to
GenerateNUTBundle._assertValidOutput. Any NUT bundle transaction whosegasLimitexceeds the Osaka cap (2**24 = 16_777_216) is now rejected at bundle-generation time rather than at execution.The EIP-7623 calldata floor check already landed in #20075. This PR folds it together with the new upper cap into a single bounded-range
require:UpgradeUtils.computeFloorDataGas).MAX_TX_GAS_LIMIT = 2**24).Also refactors
GenerateNUTBundleto separate orchestration from bundle construction so tests can validate bundles without writing the artifact:run()runssetUp, then_buildOutput, then_assertValidOutput, thenwriteArtifact._buildOutput()builds theOutputstruct with no disk I/O._assertValidOutput()performs all validation checks.A
GenerateNUTBundle_Harnesstest contract exposesbuildOutput()andassertValidOutput()externally. This lets fuzz iterations validate bundles without racing onCURRENT_BUNDLE_PATH.Tests
Full negative-path coverage for every branch in
_assertValidOutputwas added totest/scripts/GenerateNUTBundle.t.sol. Each test follows the same pattern:script.buildOutput()(harness) to produce a valid bundlescript.assertValidOutputreverts with the expected error messageCases covered:
dataintenttogasLimitabove the EIP-7825 capgasLimitof zero (rejected by the floor)gasLimitone below the EIP-7623 floorfrompaired with a non-privilegedtoThe count-mismatch test uses assembly to rewrite the in-memory array length rather than rebuilding the array. Shrink-only, because growing would blow up the ABI encoding on the external call to
assertValidOutput.Additional context
Issue #20109 calls for two checks: the EIP-7825 upper cap and an op-geth EIP-7623 floor. The floor portion was resolved by #20075. This PR adds the remaining cap check and consolidates the two into one range check.
Metadata
Closes #20109